package com.sz.admin.ai.factory.chatFactory.entity;

import com.sz.admin.ai.factory.chatFactory.handler.impl.OllamaChatHandlerImpl;
import com.sz.admin.ai.factory.chatFactory.handler.impl.OpenAiChatHandlerImpl;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;
import java.util.Objects;

/**
 * @描述: 嵌入模型平台枚举
 * @Date: 2025/1/10 09:33
 * @Author: TangYuan
 * @Date: 2025/1/10 09:33
 */
@Getter
@AllArgsConstructor
public enum ChatPlatformEnum {
    
    OLLAMA(
            "ollama",
            List.of(
                    new ChatModelEntity("DeepSeek-R1-A:14B-Q4KS"),
                    new ChatModelEntity("DeepSeek-R1-A:7B"),
                    new ChatModelEntity("deepseek-r1:7b"),
                    new ChatModelEntity("deepseek-r1:14b"),
                    new ChatModelEntity("deepseek-r1:8b"),
                    new ChatModelEntity("deepseek-r1:1.5b"),
                    new ChatModelEntity("qwen2.5:3b"),
                    new ChatModelEntity("qwen2.5:7b")
            ),
            OllamaChatHandlerImpl.class
    ),
    ALIYUN(
            "aliyun",
            List.of(
                    new ChatModelEntity("qwen-max-latest"),
                    new ChatModelEntity("qwen-max-2025-01-25"),
                    new ChatModelEntity("qwen-max"),
                    new ChatModelEntity("qwen2.5-vl-72b-instruct"),
                    new ChatModelEntity("qwen2.5-vl-7b-instruct"),
                    new ChatModelEntity("qwq-32b-preview"),
                    new ChatModelEntity("qwen-plus-latest"),
                    new ChatModelEntity("qwen-max-0919"),
                    new ChatModelEntity("qwen-plus-2025-01-25"),
                    new ChatModelEntity("qwen-turbo"),
                    new ChatModelEntity("qwen-turbo-0919"),
                    new ChatModelEntity("deepseek-v3"),
                    new ChatModelEntity("deepseek-r1"),
                    new ChatModelEntity("deepseek-r1-distill-llama-70b")
            ),
            null
    ),
    ALIYUNTHINK(
            "aliyunThink",
            List.of(
                    new ChatModelEntity("deepseek-r1"),
                    new ChatModelEntity("deepseek-r1-distill-llama-70b")
            ),
            null
    ),
    OPENAI(
            "openai",
            List.of(
                    new ChatModelEntity("qwen-max-latest"),
                    new ChatModelEntity("qwen-max-2025-01-25"),
                    new ChatModelEntity("qwen-max"),
                    new ChatModelEntity("qwen2.5-vl-72b-instruct"),
                    new ChatModelEntity("qwen2.5-vl-7b-instruct"),
                    new ChatModelEntity("qwq-32b-preview"),
                    new ChatModelEntity("qwen-plus-latest"),
                    new ChatModelEntity("qwen-max-0919"),
                    new ChatModelEntity("qwen-plus-2025-01-25"),
                    new ChatModelEntity("qwen-turbo"),
                    new ChatModelEntity("qwen-turbo-0919"),
                    new ChatModelEntity("deepseek-v3"),
                    new ChatModelEntity("deepseek-r1"),
                    new ChatModelEntity("deepseek-r1-distill-llama-70b")
            ),
            OpenAiChatHandlerImpl.class
    ),
    ;
    
    // 平台名称
    private final String platformName;
    
    // 模型名称
    private final List<ChatModelEntity> modelList;
    
    // 处理类
    private final Class<?> handlerClass;
    
    /**
     * 根据平台名称获取嵌入模型平台枚举
     * @param platformName 平台名称
     * @return {@link ChatPlatformEnum}
     */
    public static ChatPlatformEnum getEnumByPlatformName(String platformName) {
        for (ChatPlatformEnum chatPlatformEnum : ChatPlatformEnum.values()) {
            if (Objects.equals(chatPlatformEnum.platformName, platformName)) {
                return chatPlatformEnum;
            }
        }
        return null;
    }
}
